import Layout from "../components/Layout"
import BackLayout from "../components/BackLayout"


let routes = [
    {
        path: '/',
        component: Layout,
        redirect: { path: '/default' },

        meta: {
            title: '就爱淘',
            icon: "el-icon-s-operation",
            hidden: true
        },
        children: [
            {
                path: 'default',
                meta: {
                    title: '就爱淘',
                    icon: 'el-icon-house',
                    hidden: true
                },
                component: () => import('../views/default')
            },
            {
                path: 'openShop',
                meta: {
                    title: '免费开店',
                    icon: 'el-icon-house',
                    hidden: true
                },
                component: () => import('../views/openShop')
            },
            {
                path: 'newArrival',
                meta: {
                    title: '新品上市',
                    icon: 'el-icon-house',
                    hidden: true
                },
                component: () => import('../views/newArrival')
            },
            {
                path: 'consumerServices',
                meta: {
                    title: '消费者服务',
                    icon: 'el-icon-house',
                    hidden: true
                },
                component: () => import('../views/consumerServices')
            },
            {
                path: 'aboutOur',
                meta: {
                    title: '关于我们',
                    icon: 'el-icon-house',
                    hidden: true
                },
                component: () => import('../views/aboutOur')
            },
            {
                path: 'userMessage',
                meta: {
                    title: '个人信息',
                    icon: 'el-icon-house',
                    hidden: true
                },
                component: () => import('../views/userMessage')
            },
            {
                path: 'collectionGoods',
                meta: {
                    title: '收藏宝贝',
                    icon: 'el-icon-house',
                    hidden: true
                },
                component: () => import('../views/collectionGoods')
            },
            {
                path: 'collectionShop',
                meta: {
                    title: '收藏店铺',
                    icon: 'el-icon-house',
                    hidden: true
                },
                component: () => import('../views/collectionShop')
            },
            {
                path: 'classifyGoods',
                meta: {
                    title: '分类商品详情页',
                    icon: 'el-icon-house',
                    hidden: true
                },
                component: () => import('../views/classifyGoods')
            },
            {
                path: 'details',
                meta: {
                    title: '商品详情页',
                    icon: 'el-icon-house',
                    hidden: true
                },
                component: () => import('../views/details')
            },
            
            {
                path: 'selectGoods',
                meta: {
                    title: '商品搜索页',
                    icon: 'el-icon-house',
                    hidden: true
                },
                component: () => import('../views/selectGoods')
            },
            {
                path: 'checkOut',
                meta: {
                    title: '收银台',
                    icon: 'el-icon-house',
                    hidden: true
                },
                component: () => import('../views/checkOut')
            },
            {
                path: 'checkOut1',
                meta: {
                    title: '收银台1',
                    icon: 'el-icon-house',
                    hidden: true
                },
                component: () => import('../views/checkOut1')
            },
            {
                path: 'shoppingcart',
                meta: {
                    title: '购物车',
                    icon: 'el-icon-house',
                    hidden: true
                },
                component: () => import('../views/shoppingcart')
            },
            {
                path: 'order',
                meta: {
                    title: '订单页',
                    icon: 'el-icon-house',
                    hidden: true
                },
                component: () => import('../views/order')
            },
            {
                path: 'goods',
                meta: {
                    title: '细分类页',
                    icon: 'el-icon-house',
                    hidden: true
                },
                component: () => import('../views/goods')
            },
        ],
    },

    {
        path: '/login',
        meta: {
            title: '登录',
            icon: 'el-icon-house',
            hidden: true
        },
        component: () => import('../views/login')
    },
    {
        path: '/register',
        meta: {
            title: '注册',
            icon: 'el-icon-house',
            hidden: true
        },
        component: () => import('../views/register')
    },







    {
        path: '/adminhome',
        component: BackLayout,
        meta: {
            hidden: true,
            title: '根目录'
        },
        redirect: { path: '/adminhome/dashboard' },
        children:
            [
                {
                    path: '/dashboard',
                    name: 'dashboard',
                    meta: {
                        icon: "el-icon-house",
                        title: '仪表盘',
                    },
                    component: () => import('../views/dashboard')
                },
    
            ]
    },
    
    {
        path: '/system',
        component: BackLayout,
        name: 'system',
        meta: {
            icon: "el-icon-setting",
            title: '系统设置',
        },
    
        children:
            [
                {
                    path: 'user',
                    meta: {
                        icon: "el-icon-user",
                        title: "用户设置",
                    },
    
                    name: 'user',
                    component: () => import('../components/User'),
                    children:
                        [
                            {
                                path: 'users',
                                meta: {
                                    icon: "#el-icon-user",
                                    title: '用户管理',
                                },
                                component: () => import('../views/users'),
                            },
                            {
                                path: 'image',
                                meta: {
                                    title: "图片上传",
    
                                },
                                component: () => import('../views/image')
                            }
    
                        ]
                },
                {
                    path: 'role',
                    meta: {
                        title: '商品管理',
                    },
    
                    name: 'role',
                    component: () => import('../components/Role'),
                    children:
                        [
                            {
                                path: 'home',
                                meta: {
                                    icon: "#el-icon-user",
                                    title: '上架商品',
                                },
                                component: () => import('../components/Home')
                            },
                            {
                                path: 'backorder',
                                meta: {
                                    icon: "#el-icon-user",
                                    title: '订单管理',
                                },
                                component: () => import('../components/BackOrder')
                            },
                            {
                                path: 'backgoods',
                                meta: {
                                    icon: "#el-icon-user",
                                    title: '商品列表',
                                },
                                component: () => import('../components/BackGoods')
                            },
    
                        ]
                },
    
            ]
    
    },
    
    
    {
        path: '/log',
        component: BackLayout,
        redirect: { path: '/log/auditinfo' },
        meta: {
            title: '系统日志',
            icon: 'el-icon-coin',
            hidden: true,
        },
        children: [
            {
                path: 'auditinfo',
                name: 'auditinfo',
                meta: {
                    title: '审计日志',
                    icon: 'el-icon-coin',
                },
                component: () => import('../views/log'),
            },
        ],
    },
    
    
    {
        path: '/loginBack',
        meta: {
            title: "登录",
            hidden: true
        },
        component: () => import('../views/loginBack')
    },
  

]

export default routes

//异步加载组件的意义
//减少打包的结果，会将异步组件分开打包，会采用异步的方式加载组件，可以有效解决组件过大的问题
//当用到这个组件时才会进行渲染